<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Team Bonus Summary</title>
<script src="//ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script>
<link type="text/css" href="/css/start/jquery-ui-1.8.21.custom.css" rel="Stylesheet" />	
<link type="text/css" href="/css/1pxtable.css" rel="Stylesheet" />	
<script type="text/javascript" src="/js/jquery-1.7.2.min.js"></script>
<script type="text/javascript" src="/js/jquery-ui-1.8.21.custom.min.js"></script>

<title>Untitled Document</title>
<link rel="stylesheet" href="/js/chosen/chosen.css" />
</head>
<body style="font-family:Arial, Helvetica, sans-serif; line-height:20px;">
<form method = "post" action = "">
<h2>Add deduct for Staff</h2>
<?php $stDetail = new Model_DbTable_Roster_Stafflogindetail();
	  $stInfo = new Model_DbTable_Roster_Staffinfo();?>
	<table>
		
		<tr>
			<td>Staff</td>
			<td><select name="staff" data-placeholder="Staff Name" class="chzn-select" style="width:300px" >
      				<option value=""></option>
      				<?php 	$stfD = $stDetail->listAllActiveStaff();?>
        				
      					<?php foreach ($stfD as $k => $v){
      					$stShop = $stInfo->getStaffinfo($v['id']);?>
      					<option value="<?=$v["id"]?>">
        <?=ucwords($v["ni"])?>
        .
        <?=chr($v["il"]+64)?> ( <?=ucwords(Model_EncryptHelper::getSslPassword($v["n"]))?> )(<? echo $stShop['id_card']?>)
        </option>
        <?php }?>
    </select></td>
    		
		</tr>
		<tr>
			<td>Barcode:</td>
			<td><input type = "text" name = "barcode" size = "50px"></input></td>
		</tr>
		<tr>
			<td>Note:</td>
			<td><input type = "text" name = "note" size = "50px"></input></td>
		</tr>
		<tr>
			<td>Password:</td>
			<td><input type = "password" name = "password" size = "50px"></input></td>
		</tr>
	</table>	
	<br/>
<input type = "submit" name = "submit_deduct" value = "Submit"></input>
<br/>
<?php if($this->addsuccess){
		echo $this->addsuccess."<br/>";
}?>
</form>

<?php if($this->logList){?>
<br/><br/>
<h2>History</h2>
<?php foreach ($this->logList as $k => $v){
		$staff = $stDetail->getDetail($k);
		$total = 0;?>
<table width="600" border="1" cellspacing="0" cellpadding="0" style="font-size: 11px;">
	<tr>
		<td colspan = "4">Staff Name: <?php echo Model_EncryptHelper::getSslPassword($staff['n'])."(".$staff['ni'].")"?></td>
	</tr>
	<tr>
		<th>Amount</th>
		<th>Detail</th>
		<th>Autherizer</th>
		<th>Date</th>
	</tr>
	<?php foreach ($v as $k2 => $v2){?>
	<tr>
		<td>$<?php echo $v2['amount']?></td>
		<td><?php echo $v2['detail']?></td>
		<td><?php echo $v2['authorizer']?></td>
		<td><?php echo $v2['log_date']?></td>
	</tr>	
	<?php $total += $v2['amount'];}?>
	<?php ?>
	<tr>
		<td colspan = "4">Total: <?php echo $total?></td>
	</tr>
</table>
<br/>
<?php }?>
<?php }?>	



<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.6.4/jquery.min.js" type="text/javascript"></script>
  <script src="/js/chosen/chosen.jquery.js" type="text/javascript"></script>
  <script type="text/javascript"> 
    var config = {
      '.chzn-select': {allow_single_deselect:true},
    }
    for (var selector in config) {
      $(selector).chosen(config[selector]);
    }
  </script>
</body>
</html>
